package Student;

import java.util.List;
import java.util.Scanner;

public class main {
	 public static void main(String[] args) {
		 Student student1 = new Student("李明","2021428304");
		 Student student2 = new Student( "张天","2021394221");
	   	 Student student3 = new Student( "王丽","2021384293");
		 Lab classroom1 = new Lab("C001", "计算机网络实验室");
		 Lab classroom2 = new Lab("E004", "电路与模拟电子技术实验室");
		 Lab classroom3 = new Lab("N006", "数据科学与大数据技术实验室");
		 Salary.dePartureRoom(student1, classroom1);
		 Salary.dePartureRoom(student2, classroom2);
		 Salary.dePartureRoom(student3, classroom3);

		 int classroom1ExcellentCount = 3;
		 int classroom1PassCount = Salary.weekCount - classroom1ExcellentCount;
		 System.out.println(classroom1.getClassroom()+"优秀次数:" + classroom1ExcellentCount);
		 System.out.println(classroom1.getClassroom()+"合格次数:"+ classroom1PassCount);
		 List<Student> classroom1StudentList = Salary.roomStudentMap.get(classroom1.getRoomID());
		 if (classroom1StudentList != null) {
			 for (int i = 0; i < classroom1StudentList.size(); i++) {
				Student student = (Student) classroom1StudentList.get(i);
			    student.setExcellentCount(student.getExcellentCount() + classroom1ExcellentCount);
			    student.setPassCount(student.getPassCount() + classroom1PassCount);
			   }
			 }

		 int classroom2ExcellentCount = 5;
		 int classroom2PassCount = Salary.weekCount - classroom2ExcellentCount;
		 System.out.println(classroom2.getClassroom()+"优秀次数:" + classroom2ExcellentCount);
	     System.out.println(classroom2.getClassroom()+"合格次数:" + classroom2PassCount);

		 List<?> classroom2StudentList = Salary.roomStudentMap.get(classroom2.getRoomID());
		 if (classroom2StudentList != null) {
			 for (int i = 0; i < classroom2StudentList.size(); i++) {
			    Student student = (Student) classroom2StudentList.get(i);
			    student.setExcellentCount(student.getExcellentCount() + classroom2ExcellentCount);
			    student.setPassCount(student.getPassCount() + classroom2PassCount);
			   }
			  }
		 
		 int classroom3ExcellentCount = 4;
		 int classroom3PassCount = Salary.weekCount - classroom3ExcellentCount;
		 System.out.println(classroom3.getClassroom()+"优秀次数:" + classroom3ExcellentCount);
	     System.out.println(classroom3.getClassroom()+"合格次数:" + classroom3PassCount);
	     
		 List<?> classroom3StudentList = Salary.roomStudentMap.get(classroom3.getRoomID());
		 if (classroom3StudentList != null) {
			 for (int i = 0; i < classroom3StudentList.size(); i++) {
			    Student student = (Student) classroom3StudentList.get(i);
			    student.setExcellentCount(student.getExcellentCount() + classroom3ExcellentCount);
			    student.setPassCount(student.getPassCount() + classroom3PassCount);
			   }
			  }

		 System.out.println("请输入国家最新纳税标准:");
		 Scanner scanner = new Scanner(System.in);
		 while (true) {
			 try {
			    Salary.taxRate = Double.parseDouble(scanner.next());
			    break;
			   } catch (Exception e) {
			    System.err.println("纳税标准输入格式不正确");
			    System.out.println("请输入国家最新纳税标准:");
			   }
			  }
			  Salary.calculateAccout(student1);
			  Salary.calculateAccout(student2);
			  Salary.calculateAccout(student3);
			 }
}

	